﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InHD.model;
using InHD.commands;
using System.Windows.Input;

namespace InHD.viewmodels
{
    class RegisterStartPage : WorkspaceViewModel
    {
        private RegisterInfo _registerInfo;
        public string commandExcuted;
        readonly CompanyInfo _companyInfo;

        public RegisterStartPage(CompanyInfo companyInfo, RegisterInfo regInfo)
        {
            _companyInfo = companyInfo;
            _registerInfo = regInfo;
        }


        #region Presentation Property

        public RegisterInfo RegInfo
        {
            get
            {
                return _registerInfo;
            }
            set
            {
                _registerInfo = value;
            }
        }

        public string CompanyTitle
        {
            get
            {
                return string.Format("Tên đơn vị: {0} tại {1}", _companyInfo.Name, _companyInfo.Address);
            }
        }

        public string ComputerName
        {
            get
            {
                return _registerInfo.ComputerName;
            }
            set
            {
                _registerInfo.ComputerName = value;
            }
        }

        public string ComputerCode
        {
            get
            {
                return _registerInfo.ComputerCode;
            }
            set
            {
                _registerInfo.ComputerCode = value;
            }
        }

        public string OperatingName
        {
            get
            {
                return _registerInfo.OperatingName;
            }
            set
            {
                _registerInfo.OperatingName = value;
            }
        }

        public string CPUName
        {
            get
            {
                return _registerInfo.CPUName;
            }
            set
            {
                _registerInfo.CPUName = value;
            }
        }

        public string RamInfo
        {
            get
            {
                return _registerInfo.RamInfo;
            }
            set
            {
                _registerInfo.RamInfo = value;
            }
        }

        public string RequireInfo
        {
            get
            {
                return _registerInfo.RequireInfo;
            }
            set
            {
                _registerInfo.RequireInfo = value;
            }
        }

        public string PrinterInfo
        {
            get
            {
                return _registerInfo.PrinterInfo;
            }
            set
            {
                _registerInfo.PrinterInfo = value;
            }
        }

        public string PrinterProducer
        {
            get
            {
                return _registerInfo.PrinterProducer;
            }
            set
            {
                _registerInfo.PrinterProducer = value;
            }
        }

        public string PrinterRequireInfo
        {
            get
            {
                return _registerInfo.PrinterRequireInfo;
            }
            set
            {
                _registerInfo.PrinterRequireInfo = value;
            }
        }
        #endregion

        #region Command
        private RelayCommand _next;
        public ICommand NextCommand
        {
            get
            {
                if (_next == null)
                {
                    _next = new RelayCommand(
                        (param) => this.Next());
                }
                return _next;
            }
        }

        void Next()
        {
            commandExcuted = "Next";
            OnRequestClose();
        }

        private RelayCommand _cancel;
        public ICommand CancelCommand
        {
            get
            {
                if (_cancel == null)
                {
                    _cancel = new RelayCommand(
                        (param) => this.Cancel());
                }
                return _cancel;
            }
        }

        void Cancel()
        {
            commandExcuted = "Cancel";
            OnRequestClose();
        }

        #endregion
    }
}
